package fast.calc;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Buffs {
	
	public static List<String> validBuffs = 
		Arrays.asList(	"agi_flask",
						"agi_food",
						"agi_pot",
						"agi_prepot",
						"attackpower_buff",
						"attackspeed_buff",
						"casterhaste_buff",
						"spelldmg_debuff",
						"armor_debuff",
						"allstats_buff",
						"mastery_buff",
						"crit_buff",
						"physicaldmg_debuff");
	
	private Set<String> activeBuffs = new HashSet<String>();
	
	public boolean hasBuff(String name){
		if(!validBuffs.contains(name)){
			new Exception("Buff not valid: " + name);
		}
		return activeBuffs.contains(name);
	}
	
	public void addBuff(String name){
		if(!validBuffs.contains(name)){
			new Exception("Buff not valid: " + name);
		}
		activeBuffs.add(name);
	}
	
	public void removeBuff(String name){
		activeBuffs.remove(name);
	}
	
	public void removeAll(){
		activeBuffs.clear();
	}
	
	public void setBuffs(List<String> buffs){
		for(String name : buffs){
			if(!validBuffs.contains(name)){
				new Exception("Buff not valid: " + name);
			}
		}
		activeBuffs.clear();
		activeBuffs.addAll(buffs);
	}
}
